<?php
use yii\helpers\Url;
use app\common\widgets\Page;
function getLevelName($int_level) {
	switch($int_level) {
		case '1':
			$level_name = '测试';
			break;
		case '2':
			$level_name = '仿真';
			break;
		case '3':
			$level_name = '线上';
			break;
		default:
			break;
	}
	return $level_name."环境";
}
?>
<section class="vbox">
	<section class="scrollable padder">
		<div class="m-b-md">

		</div>
		<section class="panel panel-default">
			<header class="panel-heading">
				项目列表
			</header>
			<div class="row wrapper">
				<div class="col-sm-5 m-b-xs">
					<select class="input-sm form-control input-s-sm inline v-middle">
						<option value="0">Bulk action</option>
						<option value="1">Delete selected</option>
						<option value="2">Bulk edit</option>
						<option value="3">Export</option>
					</select>
					<button class="btn btn-sm btn-default">应用</button>
				</div>

				<form action="<?php echo \Yii::$app->urlManager->createUrl("project/lists"); ?>" method="post" class="form-horizontal">
					<div class="col-sm-4 m-b-xs">
						<div class="btn-group" data-toggle="buttons">
							<label class="btn btn-sm btn-default active">
								<input type="radio" name="0"> 全部
							</label>
							<label class="btn btn-sm btn-default">
								<input type="radio" name="1"> 测试环境
							</label>
							<label class="btn btn-sm btn-default">
								<input type="radio" name="2"> 仿真环境
							</label>
							<label class="btn btn-sm btn-default">
								<input type="radio" name="3"> 线上环境
							</label>
						</div>
					</div>
					<div class="col-sm-3">
						<div class="input-group">
							<input type="text" class="input-sm form-control" placeholder="请输入搜索关键词" name="keyword" value="<?php echo $filter['keyword'];?>">
                          <span class="input-group-btn">
                            <button class="btn btn-sm btn-default" type="submit">搜索</button>
                          </span>
						</div>
					</div>
				</form>
			</div>
			<div class="table-responsive">
				<table class="table table-striped b-t b-light">
					<thead>
					<tr>
						<th style="width:20px;"><label class="checkbox m-n i-checks"><input type="checkbox"><i></i></label></th>
						<th data-toggle="class">项目名称
						</th>
						<th>环境</th>
						<th>上线方式</th>
						<th>开启审核</th>
						<th>创建时间</th>
						<th>状态</th>
						<th>操作</th>
					</tr>
					</thead>
					<tbody>
					<?php foreach((array)$data as $key=>$info):?>
						<tr>
							<td><label class="checkbox m-n i-checks"><input type="checkbox" name="post[]"><i></i></label></td>
							<td><?php echo $info['name'];?></td>
							<td><?php echo getLevelName($info['level']);?></td>
							<td><?php echo $info['repo_mode'];?></td>
							<td><?php if($info['audit'] == 1) {echo "是"; }else{ echo "否";} ?></td>
							<td><?php echo $info['created_time'];?></td>
							<td>
							<?php if($info['status'] == 1){?>
								<span class="label bg-success">启用</span>
							<?php }else {?>
								<span class="label bg-danger">禁用</span>
							<?php }?>
							</td>
							<td>
								<a href="javascript:;" data-remote="<?php echo Url::toRoute(['project/view', 'id' => $info['id']]);?>" data-toggle="ajaxModal" class="btn btn-sm btn-default"> <i class="icon icon-magnifier text"></i> <span class="text">查看</span></a>
								<a href="#moreless" class="btn btn-sm btn-default"> <i class="icon icon-support text"></i> <span class="text">检测</span></a>
								<a href="#moreless" class="btn btn-sm btn-default"> <i class="fa fa-paste text"></i> <span class="text">复制</span></a>
								<a href="#moreless" class="btn btn-sm btn-default"> <i class="fa fa-group text"></i> <span class="text">成员</span></a>
								<a href="#moreless" class="btn btn-sm btn-default"> <i class="fa fa-edit text"></i> <span class="text">修改</span></a>
								<a href="#moreless" class="btn btn-sm btn-default"> <i class="icon icon-trash text"></i> <span class="text">删除</span></a>
							</td>
						</tr>
					<?php endforeach?>

<!--					<tr>-->
<!--						<td><label class="checkbox m-n i-checks"><input type="checkbox" name="post[]"><i></i></label></td>-->
<!--						<td>Formasa</td>-->
<!--						<td>8c</td>-->
<!--						<td>Jul 22, 2013</td>-->
<!--						<td>4c</td>-->
<!--						<td>Jul 25, 2013</td>-->
<!--						<td>-->
<!--							<a href="#" data-toggle="class"><i class="fa fa-check text-success text-active"></i><i class="fa fa-times text-danger text"></i></a>-->
<!--						</td>-->
<!--					</tr>-->
					</tbody>
				</table>
			</div>
			<footer class="panel-footer">
				<div class="row">
					<div class="col-sm-4 hidden-xs">
						<select class="input-sm form-control input-s-sm inline v-middle">
							<option value="0">Bulk action</option>
							<option value="1">Delete selected</option>
							<option value="2">Bulk edit</option>
							<option value="3">Export</option>
						</select>
						<button class="btn btn-sm btn-default">应用</button>
					</div>
				</div>
			</footer>
		</section>
	</section>
	<footer class="footer bg-white b-t" data-type="ajaxPage">
		<div class="row text-center-xs">
			<div class="col-md-6 hidden-sm">
				<p class="text-muted m-t">总共<?php echo $total;?>条 当前为第<?php echo $filter['page'];?>页</p>
			</div>
			<div class="col-md-6 col-sm-12 text-right text-center-xs">
				<!--                				--><?//= LinkPager::widget(['pagination' => $pages]); ?>
				<?php if($total > 0):echo Page::model(array('count'=>$total,'size'=>$limit))->show("NewPage");endif;?>
			</div>
		</div>
	</footer>
</section>